﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile.Status;

namespace MobileInfo
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }
        
        private void menuItemExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void menuItemRefresh_Click(object sender, EventArgs e)
        {
            RefreshData();
        }

        private void RefreshData()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<b>Active Application:</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.ActiveApplication).Append("<br/>").Append("<br/>").Append("<br/>");

            sb.Append("<b>Active Sync Status</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.ActiveSyncStatus.ToString()).Append("<br/>").Append("<br/>");

            sb.Append("<b>Bluetooth State Hardware Present</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.BluetoothStateHardwarePresent.ToString()).Append("<br/>").Append("<br/>");

            sb.Append("<b>Bluetooth State Power On</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.BluetoothStatePowerOn.ToString()).Append("<br/>").Append("<br/>");

            sb.Append("<b>Camera Enabled</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.CameraEnabled.ToString()).Append("<br/>").Append("<br/>");

            sb.Append("<b>CameraPresent</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.CameraPresent.ToString()).Append("<br/>").Append("<br/>");

            sb.Append("<b>Connections Bluetooth Descriptions</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.ConnectionsBluetoothDescriptions).Append("<br/>").Append("<br/>");

            sb.Append("<b>Connections Cellular Descriptions</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.ConnectionsCellularDescriptions).Append("<br/>").Append("<br/>");

            sb.Append("<b>Cradle Present</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.CradlePresent.ToString()).Append("<br/>").Append("<br/>");

            sb.Append("<b>Display Rotation</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.DisplayRotation.ToString()).Append("<br/>").Append("<br/>");

            sb.Append("<b>Owner Email</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.OwnerEmail).Append("<br/>").Append("<br/>");

            sb.Append("<b>Owner Name</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.OwnerName).Append("<br/>").Append("<br/>");

            sb.Append("<b>Owner Phone Number</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.OwnerPhoneNumber).Append("<br/>").Append("<br/>");

            sb.Append("<b>Phone Sound Profile</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.PhoneProfile).Append("<br/>").Append("<br/>");

            sb.Append("<b>Phone Roaming</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.PhoneRoaming.ToString()).Append("<br/>").Append("<br/>");

            sb.Append("<b>Phone Signal Strength</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.PhoneSignalStrength.ToString()).Append("<br/>").Append("<br/>");

            sb.Append("<b>Power Battery State</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.PowerBatteryState.ToString()).Append("<br/>").Append("<br/>");

            sb.Append("<b>Power Battery Strength</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.PowerBatteryStrength.ToString()).Append("<br/>").Append("<br/>");

            sb.Append("<b>Connections Count</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.ConnectionsCount.ToString()).Append("<br/>").Append("<br/>");

            sb.Append("<b>WiFi State Connected</b>").Append("<br/>");
            sb.AppendFormat("'{0}'", SystemState.WiFiStateConnected.ToString()).Append("<br/>").Append("<br/>");

            webBrowser.DocumentText = sb.ToString();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            RefreshData();
        }

        private void menuItemAbout_Click(object sender, EventArgs e)
        {
            frmAbout aboutForm = new frmAbout();
            aboutForm.ShowDialog();
        }
    }
}